Skip to content

Conversation

@evoactivity
Copy link
Member

Upgrading broke many tests

 Test Files  7 failed | 1 passed (8)
      Tests  1008 failed | 462 passed (1470)

@evoactivity evoactivity force-pushed the broken-prettier-3-7-1 branch from 50addc1 to 8fdb8fb Compare November 27, 2025 17:58
@evoactivity evoactivity changed the title Upgrade prettier to 3.7.1 Upgrade prettier passed 3.6.0 Nov 27, 2025
@evoactivity
Copy link
Member Author

Turns out tests break down to 3.6.0

@evoactivity
Copy link
Member Author

@evoactivity
Copy link
Member Author

Can live with the ranges not being there, easy enough to grab them from start and end.

Can't live with comments not being included. We (for reasons I don't understand yet) have all our template stuff come out as CommentBlocks. When attachComment is false we get none of them come through.

@evoactivity
Copy link
Member Author

Down to 24 failures. Majority of them because // prettier-ignore is ignored. I guess because of that attachComments being false.

@evoactivity
Copy link
Member Author

evoactivity commented Nov 27, 2025

// prettier-ignore seems to work when I run the tests in CI but not locally

apparently only 7 failures in CI 🤔

edit: I was running 3.6.0 locally, it seems 3.7.1 (or a version in between) fixed some things.

@evoactivity
Copy link
Member Author

the last 7 failures are down to a change in prettier I think, not sure

when a template is passed as an arg to a function eg

render(
  <template>
    Hello
  </template>
);

Prettier now collapses the whitespace around the arg resulting in

render(<template>
  Hello
</template>)

I'm not sure if this is an ok change we can accept or not?

@evoactivity
Copy link
Member Author

evoactivity commented Nov 27, 2025

One of those failures is a random semi-colon being inserted 😢

- Expected
+ Received

@@ -5,9 +5,9 @@
    Args: {}
    Yields: []
  }

  // prettier-ignore
- <template>
+ ;<template>
                what
              </template> as TemplateOnlyComponent<Signature>
  "

why?

@evoactivity evoactivity changed the title Upgrade prettier passed 3.6.0 Upgrade prettier past 3.6.0 Nov 27, 2025
@evoactivity
Copy link
Member Author

evoactivity commented Nov 28, 2025

I've opened an issue with prettier, if they can revert the change this PR becomes much simpler in that it just needs to fix the missing range property.

Otherwise I'll have to keep at it and figure out these last couple of issues.

By changing the comments to an object we get a different AST, which is causing the last issues because they are not identifying as an isGlimmerTemplateParent (I think). If anyone else can figure out how to make it work this way, then please, have a go.

node.range = [node.start, node.end];
}
assert('expected range', node.range);
const [start, end] = node.range;
Copy link
Contributor

@fisker fisker Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use typescript.{locStart,locEnd}() which works for all prettier js parsers, and won't break.

@evoactivity
Copy link
Member Author

Superceded by #408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants